/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"4E481E4E-91F1-4B82-9693-EFB3E56839CF"}
 */
var busqueda_cliente = "";

/**
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2327ACC0-DF75-49EA-882A-9A5DF2304E68"}
 */
function btn_alta_cliente(event) {
		
		var win = application.createWindow(application.getUUID().toString(),JSWindow.MODAL_DIALOG);
		win.resizable = false;
		win.storeBounds = false;
		win.undecorated = false;
		
		forms.CLIENTE_EDIT.controller.newRecord();
		forms.CLIENTE_EDIT.elements.btn_baja.visible = false;
		forms.CLIENTE_EDIT.elements.btn_volver.visible = false;
		win.show(forms.CLIENTE_EDIT);
		
		
	}

/**
 * @param {Object} event
 *
 * @properties={typeid:24,uuid:"DFDC6B64-5265-4E1B-9863-6C10463BB29F"}
 */
function btn_ver_ficha(event) {
		
	var win = application.createWindow(application.getUUID().toString(),JSWindow.MODAL_DIALOG);
	win.resizable = false;
	win.storeBounds = false;
	win.undecorated = false;
	
	forms.CLIENTE_EDIT.elements.bnt_aceptar.visible = false;
	forms.CLIENTE_EDIT.elements.btn_cancelar.visible = false;
	forms.CLIENTE_EDIT.elements.btn_volver.visible = true;
	forms.CLIENTE_EDIT.elements.btn_baja.visible = true;
	win.show(forms.CLIENTE_EDIT);

	}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"CB76B0E3-57B1-4EB2-BE36-58FC15453E5B"}
 */
function btn_aceptar(event) {
	busqueda_cliente = forms.CLIENTES_lst.foundset.getSelectedRecord().clientes_id;
	controller.getWindow().destroy();
}

/**
 * // TODO generated, please specify type and doc for the params
 * @param {Object} event
 *
 * @properties={typeid:24,uuid:"B6EB507E-F2E0-4F68-9734-20749BCED108"}
 */
function btn_cancelar(event) {
	
	databaseManager.revertEditedRecords();
	var win = controller.getWindow();
	win.destroy();
	
}

/** BUSQUEDA DE CLIENTE MEDIANTE CAMPO DE TEXTO
 * @AllowToRunInFind
 * 
 * @param {Object} oldValue
 * @param {Object} newValue
 * @param {Object} event
 * 
 * @properties={typeid:24,uuid:"604564C2-68EE-4404-A70C-FC144122FA9A"}
 */
function onDataChange(oldValue, newValue, event) {

			if (forms.VENDEDOR_lst.foundset.find()){
				
				forms.VENDEDOR_lst.nombre = "#%" + busqueda_cliente + "%";
				forms.VENDEDOR_lst.foundset.search();
				
				
				return true;
			}else
				return false;
				
				
		}
